<template>
    <view class="main">
        <view class="content">
            <rich-text :nodes="poData"></rich-text>
        </view>
    </view>
</template>

<script lang="ts" setup>
import { onLoad } from '@dcloudio/uni-app'
import { ref } from 'vue';
import { getPolicy } from '@/api/home/home'

const type = ref<string | number>('')
const typeData = ref<string>('')
onLoad((option) => {
    type.value = option!.type as (string | number)
    typeData.value = type.value == 1 ? 'service' : 'privacy'
    getPolicyData()
    uni.setNavigationBarTitle({
        title: type.value == 1 ? '用户协议' : '隐私协议'
    })
})

// 获取协议
let poData = ref<string>('')
const getPolicyData = async () => {
    const res = await getPolicy({ type: typeData.value })
    if (res.code == 0) {
        poData.value = res.data.content
        console.log(res)
    }
}
</script>

<style lang="scss" scoped>
.main {
    padding: 30rpx;

    .content {
        background: #FFFFFF;
        border-radius: 20rpx;
        padding: 30rpx;
        font-family: PingFang SC, PingFang SC;
        font-weight: 400;
        font-size: 26rpx;
        color: #7E7E7E;
        line-height: 50rpx;
    }
}
</style>